/*
 *  JDiv - API for Multimedia Application
 *  http://jdiv.sourceforge.net 
 *  ------------------------------------
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

package com.jdiv.functions;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Interpolation;
import com.jdiv.kernel.JDivSystem;

/** Class that handles the Display functions. */

public class FunctionsScreen {

	/**
	  * Sets the color screen cleaning.
	  * @param rgba Color obtained with the function: {@link com.jdiv.functions.FunctionsGraphic#getColorFloat(float, float, float, float)}. 
	  */
	 
	 public void setClearColor( int rgba ){
		 JDivSystem.setClearColor( rgba );
	 }
	 
	 /**
	  * Sets the color fade of screen.
	  * @param rgba
	  */
	 
	 public void setFadeColor( int rgba ){
		 JDivSystem.setFadeColor( rgba );
	 }
	 
	 /**
	  * Disable the color screen cleaning.
	  */
	 
	 public void disableClearColor(){
		 JDivSystem.disableClearColor();	 
	 }
	 
	 /** 
	  * @return Width screen of the scenes.
	  */
	 
	 public int getWidth(){
		 return Gdx.graphics.getWidth();
	 }

	 /**  
	  * @return Height screen of the scenes.
	  */
	 
	 public int getHeight(){
		 return Gdx.graphics.getHeight();
	 }
	 
	 /**
	  * Screen fade to the current color in the seconds set.
	  */
	 
	 public void fadeIn(){
		 fadeIn( 0.5f, null );
	 }
	 
	 /**
	  * Screen fade to the current color in the seconds set.
	  * @param timeSeconds Time of fade in seconds.
	  */
	 
	 public void fadeIn( float timeSeconds ){
		 fadeIn( timeSeconds, null );
	 }
	 
	 /**
	  * Screen fade to the current color in the seconds set.
	  * @param timeSeconds Time of fade in seconds.
	  * @param interpolation Use Interpolation of LibGdx for the changes the level of fade.
	  */
	 
	 public void fadeIn( float timeSeconds, Interpolation interpolation ){
		 
		 if( timeSeconds == 0 )
			 JDivSystem.fadeInTime = timeSeconds + 0.001f;
		 else
			 JDivSystem.fadeInTime = timeSeconds;
		 
		 JDivSystem.isFading   = true;
		 JDivSystem.fadeInInterpolation = interpolation;
	 }
	 
	 /**
	  * Screen fades to the black in the seconds set.
	  */
	 
	 public void fadeOut(){
		 fadeOut( 0.5f, null );
	 }
	 
	 /**
	  * Screen fades to the black in the seconds set.
	  * @param timeSeconds Time of fade in seconds.
	  */
	 
	 public void fadeOut( float timeSeconds ){
		  fadeOut( timeSeconds, null );
	 }
	 
	 /**
	  * Screen fades to the black in the seconds set.
	  * @param timeSeconds Time of fade in seconds.
	  * @param interpolation Use Interpolation of LibGdx for the changes the level of fade.
	  */
	 
	 public void fadeOut( float timeSeconds, Interpolation interpolation ){
		 
		 if( timeSeconds == 0 )
			 JDivSystem.fadeOutTime = timeSeconds + 0.001f;
		 else
			 JDivSystem.fadeOutTime = timeSeconds;	 
		 
		 JDivSystem.isFading    = true;
		 JDivSystem.fadeOutInterpolation = interpolation;
	 }
	 
	 /**
	  * Checking if fades scenes. 
	  * @return True if screen fading or no fading fake screen.
	  */
	 
	 public boolean isFading( ){
		 return JDivSystem.isFading;
	 }
}
